/**
 * 鱼群种类表
 */
class FishTpl{
    private static _instance:FishTpl  = null;
    private data:Object = null;

    public constructor()
    {
        this.data = JsonUtil.getData("fish_define_json");
    }

    public static instance()
    {
        if(!this._instance)
        {
            this._instance = new FishTpl();
        }
        return this._instance;
    }

    //通过id拿取对应的鱼数据
    public getDataById(id)
    {
        if(this.data && this.data[id])
        {   
            return this.data[id];
        }
        else
        {
            return null;
        }
    }

    //通过鱼品质获取鱼速度
    //目前限定为一次函数
    public getSpeedByQuilty(qulity:number)
    {
        let speed = GameConst.normalSpeed;
        return speed * qulity + 0.8;
    }

    //拿取所有鱼的数据
    public getDataAsArray():Array<Object>
    {
        let arr = [];
        for(let k in this.data)
        {
            arr.push(this.data[k]);
        }
        return arr;
    }
}